﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhy.MvvmBaseObject
{
    /// <summary>
    /// 基础ViewModel类
    /// </summary>
    public class MainViewModel:BindableBase
    {
        // 基础的通知属性
        private string _value;

        public string Value
        {
            get { return _value; }
            set
            {
                // 第一种方式
                SetProperty<string>(ref _value, value);

                // 第二种方式
                //_value = value;
                //this.RaisePropertyChanged(nameof(Value));

                // 第三种方式
                //_value = value;
                //this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs(nameof(Value)));
            }
        }

        /// <summary>
        /// 命令属性定义
        /// </summary>
        public DelegateCommand<object> ButtonCommand { get; set; }

        /// <summary>
        /// 构造方法
        /// </summary>
        public MainViewModel()
        {
            ButtonCommand = new DelegateCommand<object>(btn_Click); // 命令注册
        }

        /// <summary>
        /// 命令方法
        /// </summary>
        /// <param name="arg"></param>
        private void btn_Click(object arg) 
        {
            
        }

    }
}
